package hu.bme.mit.inf.expendables.entities;
	
import javax.persistence.*;
import hu.bme.mit.inf.expendables.entities.*;
import java.util.List;
import java.util.ArrayList;


@Entity
@Table(name="T_APP")
@NamedQueries(
	{
	@NamedQuery(name=App.GET_APP,query="SELECT a FROM App a WHERE a.appId = :appId"),
	@NamedQuery(name=App.DELETE_APP,query="DELETE FROM App a WHERE a.appId = :appId"),
	@NamedQuery(name=App.UPDATE_APP,query="UPDATE App a SET a.appFile = :appFile, a.fileName = :fileName WHERE a.appId = :appId")
	})
public class App {
	                        	
	public static final String GET_APP = "GetApp";
	public static final String DELETE_APP = "DeleteApp";
	public static final String UPDATE_APP = "UpdateApp";

	//Attributes
	private byte[] appFile;
	
	@Id
	@GeneratedValue
	@Column(name="APP_ID")
	private long appId;
	
	private String fileName;
	

	//Reference to AppMetadata
	@OneToOne(mappedBy="app")
	private AppMetadata appMetadata;
	


	//Getters and Setters
	public byte[] getAppFile(){
		return appFile;
	}
	
	public void setAppFile(byte[] appFile){
		this.appFile = appFile;
	}
	
	public long getAppId(){
		return appId;
	}
	
	public void setAppId(long appId){
		this.appId = appId;
	}
	
	public String getFileName(){
		return fileName;
	}
	
	public void setFileName(String fileName){
		this.fileName = fileName;
	}
	

	public AppMetadata getAppMetadata(){
		return appMetadata;
	}
	
	public void setAppMetadata(AppMetadata appMetadata){
		this.appMetadata = appMetadata;
	}
		
}